<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	template="../templates/ui.xhtml">
	
	<ui:define name="content">

		<h1 class="title ui-widget-header ui-corner-all">PPR - Partial Tree Process</h1>
		<div class="entry">
			<p>You can choose which components to process in JSF lifecycle using the process attribute. This is very useful to do partial validations, model update, invoke application and more.
			This simply makes immediate, subforms and regions obselete. Keywords like @this, @form, @all, @none, @parent makes it even easier to choose what to process.
			just for ajax. Following example demonstrates several combinations.</p>

			<h:form>
				
				<p:panel header="Partial Process">
					
					<h:panelGrid id="grid" columns="2" style="margin-bottom:10px">
						<f:facet name="header">
							<p:messages />
						</f:facet>
					
						<h:outputLabel for="firstname" value="Firstname:" />
						<p:inputText id="firstname" value="#{personBean.firstname}" />
								
						<h:outputLabel for="surname" value="Surname: *" />
						<p:inputText id="surname" value="#{personBean.surname}" required="true"/>
					</h:panelGrid>
					
				</p:panel>
				
				<h:panelGrid columns="6" cellpadding="5">
					<p:commandButton value="All" process="@all" update="grid" actionListener="#{personBean.savePerson}"/>
					<p:commandButton value="Form" process="@form" update="grid" actionListener="#{personBean.savePerson}"/>
					<p:commandButton value="This" process="@this" update="grid" actionListener="#{personBean.savePerson}"/>
					<p:commandButton value="None" process="@none" update="grid" actionListener="#{personBean.savePerson}"/>
					<p:commandButton value="Parent" process="@parent" update="grid" actionListener="#{personBean.savePerson}"/>
					<p:commandButton value="This Surname" process="@this,surname" update="grid" actionListener="#{personBean.savePerson}"/>
				</h:panelGrid>

			</h:form>
		
			<h3>Source</h3>
			<p:tabView>
				<p:tab title="pprPartialTree.xhtml">
					<pre name="code" class="xml">
&lt;h:form&gt;
	
	&lt;p:panel header="Partial Process"&gt;
		
		&lt;h:panelGrid id="grid" columns="2" style="margin-bottom:10px"&gt;
			&lt;f:facet name="header"&gt;
				&lt;p:messages /&gt;
			&lt;/f:facet&gt;
		
			&lt;h:outputLabel for="firstname" value="Firstname:" /&gt;
			&lt;p:inputText id="firstname" 
						value="\#{personBean.firstname}" /&gt;
					
			&lt;h:outputLabel for="surname" value="Surname: *" /&gt;
			&lt;p:inputText id="surname" 
						value="\#{personBean.surname}" required="true"/&gt;
		&lt;/h:panelGrid&gt;
		
	&lt;/p:panel&gt;
	
	&lt;h:panelGrid columns="6" cellpadding="5"&gt;
		&lt;p:commandButton value="All" process="@all" update="grid" 
					actionListener="\#{personBean.savePerson}"/&gt;
		&lt;p:commandButton value="Form" process="@form" update="grid" 
					actionListener="\#{personBean.savePerson}"/&gt;
		&lt;p:commandButton value="This" process="@this" update="grid" 
					actionListener="\#{personBean.savePerson}"/&gt;
		&lt;p:commandButton value="None" process="@none" update="grid" 
					actionListener="\#{personBean.savePerson}"/&gt;
		&lt;p:commandButton value="Parent" process="@parent" update="grid" 
					actionListener="\#{personBean.savePerson}"/&gt;
		&lt;p:commandButton value="This Surname" process="@this,surname" update="grid" 
					actionListener="\#{personBean.savePerson}"/&gt;
	&lt;/h:panelGrid&gt;

&lt;/h:form&gt;
					</pre>
				</p:tab>
				
				<p:tab title="PersonBean.java">
							
			<pre name="code" class="java">
package org.primefaces.examples.view;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;

public class PersonBean {

	private String firstname;
	
	private String surname;

	public String getFirstname() {
		return firstname;
	}
	public void setFirstname(String firstname) {
		this.firstname = firstname;
	}

	public String getSurname() {
		return surname;
	}
	public void setSurname(String surname) {
		this.surname = surname;
	}
	
	public void savePerson(ActionEvent actionEvent) {
		FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Welcome " + firstname + " " + surname + "!"));
	}
}
			</pre>
				</p:tab>
			</p:tabView>

		</div>
				
	</ui:define>
</ui:composition>